<?php use Backend\Controller\Plugin\AuthorizationPlugin; ?>

<?php echo $this->partial('sejour/sejourNavPartial', array (
    'sejourId' => $this->id
  ));
?>

<div ng-app="sejourModule">
	<div class="table-responsive" ng-controller="GalerieSejourController">
		<div class="row">

			
			<alert ng-repeat="alert in alerts" type="alert.type" close="closeAlert($index)">{{alert.msg}}</alert>

			<div class="panel panel-primary">
				<div class="panel-heading">Ajouter des images &#224; la galerie <em>(max. 4 Mo / image)</em></div>
				<div class="panel-body">
					<form name="formFiche" class="formFiche" novalidate>
						<input type="hidden" id="id" name="id" value="<?php echo $this->id;?>">
						<div class="row">
							<div class="col-lg-6">
								<div class="row">
									<div class="col-lg-3">
										<div class="control-group">
											<div class="form-group">
											    <div class="controls">
											        <span class="btn btn-success fileinput-button">
											            <i class="fa  fa-plus-circle"></i>
											            <input type="file" name="file" data-url="ressourceImage" 
											                   multiple upload><span>Parcourir...</span>
											        </span>
											    </div>
											</div>
										</div>
									</div>
									<div class="col-lg-9">
										<div class="progress" ng-show="percentage">
										    <div class="progress-bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" style="width: {{percentage}}%;">
										    	<span>{{percentage}}% Complete</span>
										    </div>
										</div>
									</div>	
								</div>
							</div>							
							<div class="col-lg-6">
								<div class="row">
									<div class="col-lg-3">
										<div class="form-group">
											<button type="submit" ng-disabled="!files.length" ng-click="upload()" class="form-control btn btn-primary">Uploader</button>
										</div>
									</div>
									<div class="col-lg-3">
										<div class="form-group">
											<button ng-click="cancel()" ng-disabled="!files.length" type="button" class="form-control btn btn-default">Annuler</button>
										</div>
									</div>
								</div>
							</div>
						</div>
						<div class="row">
							<div class="col-lg-6">
								<table class="table table-bordered table-hover table-striped tablesorter">
									<thead>
								    	<tr>
											<th>
												<span ng-show="!files.length && !percentage">Aucunes images sélectionnées</span>
												<span ng-show="files.length && !percentage">Fichiers</span>
												<span ng-show="percentage">En cours de téléchargement</span>
											</th>
										</tr>
									</thead>
									<tbody>
										<tr ng-repeat="file in files">
												<td>{{file.name}}   <em>({{ file.size | sizeConverterFilter:1 }})</em></td>
											</tr>
									</tbody>
								</table>
							</div>
						</div>
					</form>
				</div>
			</div>	
		</div>

		<div class="row col-lg-9">
			<div class="panel panel-default">
				<div class="panel-heading">Contenus de la galerie</div>
				<table id="galerie-sejour" class="table table-hover table-striped tablesorter">
			    	<thead>
			        	<tr>
							<th>Image </th>
							<th>&nbsp;</th>
						</tr>
					</thead>
					<tbody>
						<tr ng-repeat="image in images">
								<td>
									<sejourgalerie th-id="{{image.sejourId}}" th-nom="{{image.image}}" th-libelle="{{image.image}}"/>
								</td>
								<td style="vertical-align: middle;">
									<div class="col-lg-6">
										<button ng-click="deleteImage(image)" type="button" class="form-control btn btn-primary">Supprimer</button>
									</div>
								</td>
							</tr>
					</tbody>
				</table>
			</div>

			
		</div>
	</div>
</div>	
